package com.iqiyi.pps.epg.api.server.impl;

import com.iqiyi.pps.epg.api.server.iservice.CarouselApiService;
import com.iqiyi.pps.epg.api.server.proxy.CarouselProxy;
import com.iqiyi.pps.epg.api.utils.CrossDataLocalPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by karkarrotxu on 2016/9/19.
 */
@Service("carouselApiServiceImpl")
public class CarouselApiServiceImpl extends ApiServiceImpl implements CarouselApiService {

    @Autowired
    private CarouselProxy carouselProxy;

    // 轮播台 - 创建自动规则
    public String carouselCreate(String fatherId, String qipuId, String showName, String startTime, String itemTime,
                                 String startNum, String followNum, String totalNum, String repeatedStatus, String followedStatus,
                                 String channelTag, String copyrightEndTime, String bossStatus, String publishStatus,
                                 String createDays, String createStartTime, String pageUrl, String actualNum) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.carouselCreate(fatherId, qipuId, showName, startTime, itemTime,
                startNum, followNum, totalNum, repeatedStatus, followedStatus,
                channelTag, copyrightEndTime, bossStatus, publishStatus,
                createDays, createStartTime, pageUrl, actualNum);
    }

    // 轮播台 - 删除自动规则
    public String carouselDel(String ids, String fatherId) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.carouselDel(ids, fatherId);
    }

    // 轮播台 - 获取自动规则列表
    public String carouselGet(String fatherId, Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.carouselGet(fatherId, pageNo, pageSize);
    }

    public String getCarouselAutomationList(long channelId, Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.getCarouselAutomationList(channelId, pageNo, pageSize);
    }

    public String addCarouselAutomation(String data) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.addCarouselAutomation(data);
    }

    public String changeStatusCarouselAutomation(long channelId, int execStatus) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.changeStatusCarouselAutomation(channelId, execStatus);
    }

    /**
     * 轮播台自动化表单
     */
    public String delCarouselAutomation(String ids, long channelId) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.delCarouselAutomation(ids, channelId);
    }

    public String moveAutomationIndex(long id, long aimId, long channelId) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.moveAutomationIndex(id, aimId, channelId);
    }


    public String getCarouselEpisodeList(long channelId, Integer pageNo, Integer pageSize
    ) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.getCarouselEpisodeList(channelId, pageNo, pageSize);
    }


    public String carouselEpisodeBatchAdd(String dataString, String fatherId) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.carouselEpisodeBatchAdd(dataString, fatherId);
    }

    public String carouselEpisodeBatchDel(String ids, String channelId) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.carouselEpisodeBatchDel(ids, channelId);
    }


    public String moveCarouselEpisodeIndex(long id, long aimId, long channelId) {
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.moveCarouselEpisodeIndex(id, aimId, channelId);
    }

    public String moveAutomationIndexByIndex(long id,  int aimIdx,  long channelId){
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.moveAutomationIndexByIndex(id, aimIdx, channelId);
    }
    public String moveCarouselEpisodeIndexByIndex( long id, int aimIdx, long channelId){
        CrossDataLocalPool.set(getCrossData());
        return carouselProxy.moveCarouselEpisodeIndexByIndex(id, aimIdx, channelId);
    }
}
